package com.uit.project.bustrip;

import java.util.List;

import com.uit.project.bustrip.R;
import com.uit.project.bustrip.bo.CustomerBOImpl;
import com.uit.project.bustrip.bo.UserBOImpl;
import com.uit.project.bustrip.bointerface.CustomerBO;
import com.uit.project.bustrip.bointerface.UserBO;
import com.uit.project.bustrip.entity.Customer;
import com.uit.project.bustrip.entity.User;
import com.uit.project.bustrip.main.UserList;
import com.uit.project.bustrip.main.UserLogin;

import android.os.Bundle;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.widget.Button;

public class Main extends Activity {

	Button button1;
	Button button2;
	
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        CustomerBO customerBO = new CustomerBOImpl(getApplicationContext());
        List<Customer> customers = customerBO.findAll();
        Log.i("shs", String.valueOf(customers.size()));
        for (Customer customer : customers) {
        	Log.i("Customer =>", customer.email);
        	Log.i("Customer =>", customer.username);
        	Log.i("Customer =>", customer.numberphone);
		}
//        initData();
//        initView();
    }
    private void initView(){
//    	button1.setOnClickListener(new View.OnClickListener() {
//			@Override
//			public void onClick(View v) {
//				UserBO userBo = new UserBOImpl(getApplicationContext());
//				User u = userBo.getInstance();
//				if(u == null){
//					Intent i = new Intent(getApplicationContext(),CustomerLogin.class);
//					startActivity(i);
//				}
//			}
//		});
        button2.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				Intent i = new Intent(getApplicationContext(),UserList.class);
				startActivity(i);
			}
		});
    }
    protected void initData() {
		button1 = (Button) findViewById(R.id.button1);
//		button2 = (Button) findViewById(R.id.button2);
	}


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }
    
}
